package org.boot.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class RedisBean {
    //    private final StringRedisTemplate stringRedisTemplate;
//    private final RedisTemplate<String, Object> redisTemplate;
    /*@Autowired
    public RedisBean(@Qualifier("redisTemplate") RedisTemplate<String, Object> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }*/
    @Autowired
    private RedisTemplate<Object, Object> redisTemplate;

    public String getName(String key) {

        redisTemplate.opsForValue().set("1", "32");

        Object obj = redisTemplate.opsForValue().get(key);
        System.out.println(obj);
        return "redis";
    }

}
